home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000016_fdc@columbia.edu_Thu Apr 4 09:51:06 EST 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  89 lines

  1. Article: 13286 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: kermit scripts, full-duplex
  6. Date: 4 Apr 2002 09:50:47 -0500
  7. Organization: Columbia University
  8. Lines: 72
  9. Message-ID: <a8hp87$mc8$1@watsol.cc.columbia.edu>
  10. References: <a228ca9f.0204040327.edef2d6@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1017931849 19503 128.59.39.139 (4 Apr 2002 14:50:49 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 4 Apr 2002 14:50:49 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13286
  16.  
  17. In article <a228ca9f.0204040327.edef2d6@posting.google.com>,
  18. ALB <casimir@roar.com> wrote:
  19. :
  20. : Is it possible to write a basic kermit script to perform full-duplex
  21. : transfer ?
  22. :
  23. : The aim is to perform modem tests, without any protocols. Basically,
  24. : send and receive the "check fox" string in loop, and verify
  25. : automatically that no character are lost. The constraint is to be
  26. : really full-duplex, and not sequentially send or receive.
  27. Kermit scripts are single-process, single-thread.  But that should not
  28. be an impediment; the underlying operating system's device drivers
  29. take care of full-duplex i/o (interrupt handling, buffering) for you.
  30.  
  31. : it would be something like that:
  32. :  wait_connection()
  33. :  while (true){
  34. :   how_many_bytes_can_I_send(&nb_bytes_tx)
  35. :   send_fox_string(nb_bytes_tx)
  36. :   get_number_of_bytes_received(&nb_bytes_rx)
  37. :   read_bytes(buff_p, nb_bytes_rx)
  38. :   check_fox_string(buff_p, nb_bytes)
  39. : }
  40. You'd set up the connection like this:
  41.  
  42.   set port /dev/ttyS0               ; Or other device
  43.   if fail exit 1 Can't get port: \v(errstring)
  44.  
  45.   set speed 57600                   ; or other desired speed
  46.   set carrier-watch off             ; you might need this
  47.   set flow rts/cts                  ; or other appropriate flow control
  48.  
  49. Then your echo checking loop could be like this (send a character,
  50. read back its echo):
  51.  
  52.   .string = "check fox"             ; Define test string
  53.   .len := \flen(\m(string))         ; Its length
  54.  
  55.   while true {
  56.       for \%i 1 \m(len) 1 {
  57.           output \s(string[\%i:1])  ; Send a character
  58.           if fail exit 1 Fatal i/o error on output: \v(errstring)
  59.           input 2 \s(string[\%i:1]) ; Wait 2 sec for echo
  60.           if fail {
  61.           echo [\s(string[\%i:1])] TIMED OUT: \v(inwait) sec
  62.               echo Restarting...
  63.               pause 1
  64.               clear input
  65.               break
  66.           } else {
  67.           echo [\s(string[\%i:1])] OK: \v(intime) msec
  68.           }
  69.       }
  70.       output \13                    ; Send a carriage return
  71.   }
  72.  
  73. \s(blah[i:n]) means the substring of the string defined by the macro
  74. whose name is "blah", starting at (1-based) position "i", length "n" bytes.
  75. \v(intime) is the number of milliseconds it took for the echo to arrive.
  76. \v(inwait) is the timeout interval on the INPUT command in seconds (it
  77. needn't be hardwired -- you can use a variable).
  78.  
  79. Of course you could be more fancy -- send the whole string, read back the
  80. echo a character at a time, etc, whatever you want.
  81.  
  82. More about Kermit script programming here:
  83.  
  84.   http://www.columbia.edu/kermit/ckscripts.html
  85.  
  86. - Frank
  87.